import { user_all } from "./apis";
import type { IStoreState } from "./store";
import type { SimpleUser } from "./apis";

export const baseInfo = async (): Promise<IStoreState["userMap"]> => {
  const userMap = new Map<SimpleUser["username"], SimpleUser>();
  const userList = (await user_all())?.data || [];

  for (const user of userList) {
    userMap.set(user.username, user);
  }

  return userMap;
};
